package net;

import message.Registration;

public class RegistrationSender extends Sender {

	private RegistrationSender(Registration registration) {
		super(registration);
	}

	@Override
	void handleResponse(int response) {
		if(response == Registration.INVALID_USERNAME)
			this.handleInvalidUsername();
		else
			this.handleSuccesfulRegistration();
	}
	
	private void handleInvalidUsername(){}
	private void handleSuccesfulRegistration(){}
	
	public static void sendRegistration(String username, String password){
		ReceiverThread.createReceiverThread();
		
		int inputPort = OlivawPortsClient.getInputPort();
		Registration registration = new Registration(username, password, inputPort, 0, 0);
		new Thread(new RegistrationSender(registration)).start();
	}

}
